package org.lucky.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.lucky.admin.mapper.UserMapper;
import org.lucky.admin.service.IUserService;
import org.lucky.mapper.LuckyMapper;
import org.lucky_common.domain.LuckyShare;
import org.lucky_common.domain.User;
import org.lucky_common.util.AjaxResult;
import org.lucky_common.vo.LuckyShareExportVo;
import org.lucky_common.vo.UserExportVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {


    @Override
    public List<UserExportVo> getUserExportList() {
        List<User> users = this.list();
        //users集合转成export集合
        return users.stream().map(user -> {
            UserExportVo vo = new UserExportVo();
            BeanUtils.copyProperties(user, vo);
            return vo;
        }).collect(Collectors.toList());
    }
}
